<?php

use Illuminate\Auth\UserInterface;
use Illuminate\Auth\Reminders\RemindableInterface;

class Tai_khoan extends Eloquent implements UserInterface, RemindableInterface {

    /**
     * The database table used by the model.
     *
     * @var string
     */
    public $timestamps = false;
    protected $guarded = array();
    public static $rules = array(
        'username' => array('required','min:6','unique:tai_khoans'),
        'password' => array('required','min:6'),
        'remember_token' => '',
        'mascb' => 'required',
        'ho_cb' => 'required',
        'ten_cb' => 'required',
        'ngay_sinh_cb' => '',
        'gioi_tinh_cb' => '',
        'email_cb' => 'required',
        'sdt_cb' => '',
        'dia_chi_cb' => '',
        'chuc_danh' => '',
        'chuc_vu' => ''
    );
    public static $rules_student = array(
        'username' => array('required','min:6','unique:tai_khoans'),
        'password' => array('required','min:6'),
        'remember_token' => '',
        'fullname'=> 'required',
        'password'=> 'required',
        'email'=> 'required',
        'birthday'=> 'required',
        'phone'=> 'required',
        'gender'=> 'required',
        'active' => 'required'
    );
    public static $rules_pass = array(
        'username' => array('required','min:6','unique:tai_khoans'),
        'remember_token' => '',
        'mascb' => 'required',
        'ho_cb' => 'required',
        'ten_cb' => 'required',
        'ngay_sinh_cb' => '',
        'gioi_tinh_cb' => '',
        'email_cb' => 'required',
        'sdt_cb' => '',
        'dia_chi_cb' => '',
        'chuc_danh' => '',
        'chuc_vu' => ''
    );
     public static $rules_user = array(
        'password' => array('required','min:6'),
        'remember_token' => '',
        'mascb' => 'required',
        'ho_cb' => 'required',
        'ten_cb' => 'required',
        'ngay_sinh_cb' => '',
        'gioi_tinh_cb' => '',
        'email_cb' => 'required',
        'sdt_cb' => '',
        'dia_chi_cb' => '',
        'chuc_danh' => '',
        'chuc_vu' => ''
    );
    protected $table = 'tai_khoans';
    protected $fillable = array('username', 'password','username','password','remember_token','mascb','ho_cb','ten_cb','ngay_sinh_cb','gioi_tinh_cb' ,'email_cb' ,'sdt_cb','dia_chi_cb' ,'chuc_danh','chuc_vu' );

    /**
     * The attributes excluded from the model's JSON form.
     *
     * @var array
     */
    protected $hidden = array('password');

    /**
     * Get the unique identifier for the user.
     *
     * @return mixed
     */
    public function getAuthIdentifier() {
        return $this->getKey();
    }

    /**
     * Get the password for the user.
     *
     * @return string
     */
    public function getAuthPassword() {
        return $this->password;
    }

    /**
     * Get the token value for the "remember me" session.
     *
     * @return string
     */
    public function getRememberToken() {
        return $this->remember_token;
    }

    /**
     * Set the token value for the "remember me" session.
     *
     * @param  string  $value
     * @return void
     */
    public function setRememberToken($value) {
        $this->remember_token = $value;
    }

    /**
     * Get the column name for the "remember me" token.
     *
     * @return string
     */
    public function getRememberTokenName() {
        return 'remember_token';
    }

    /**
     * Get the e-mail address where password reminders are sent.
     *
     * @return string
     */
    public function getReminderEmail() {
        return $this->email;
    }

}
